package gr.handmademarket.po.implementations;

import gr.handmademarket.po.enums.Role;
import gr.handmademarket.po.interfaces.Category;
import gr.handmademarket.po.interfaces.User;

import java.io.Serializable;
import java.util.HashSet;
import java.util.Set;

/**
 * the seller
 */
public class Seller 
implements User, Category, Serializable{

	/**
	 * serialVersionUID
	 */
	private static final long serialVersionUID = 1L;

	/**
	 * the username.
	 */
	private String username;
	
	/**
	 * the password.
	 */
	private String password;

	/**
	 * description.
	 */
	private String shortBio;
	
	/**
	 * shop notes.
	 */
	private String shopNotes;
	
	/**
	 * the first name.
	 */
	private String firstName;
	
	/**
	 * the last name.
	 */
	private String lastName;
	
	/**
	 * the code.
	 */
	private int code;
	
	/**
	 * the parent category.
	 */
	private Category parent;
	
	/**
	 * the shop.
	 */
	private Shop shop;
	
	/**
	 * children categories.
	 */
	private Set<Category> children = new HashSet<Category>();
	
	public String getUsername() {
		return username;
	}

	public void setUsername(String username) {
		this.username = username;
	}

	public String getPassword() {
		return password;
	}

	public void setPassword(String password) {
		this.password = password;	
	}

	public Role getRole() {
		return Role.SELLER;
	}

	public int getCode() {
		return code;
	}

	public void setCode(int code) {
		this.code = code;
	}

	@SuppressWarnings("nls")
	public String getName() {
		return firstName + " " + lastName;
	}

	public void setName(String name) {
		// empty
	}

	public boolean isLeaf() {
		return false;
	}
	
	public String getFirstName() {
		return firstName;
	}

	public void setFirstName(String firstName) {
		this.firstName = firstName;
	}

	public String getLastName() {
		return lastName;
	}

	public void setLastName(String lastName) {
		this.lastName = lastName;
	}
	
	public Category getParent() {
		return parent;
	}
	
	public void setParent(Category parent) {
		this.parent = parent;
	}
	
	public boolean isRoot() {
		return parent == null;
	}

	public Set<Category> getChildren() {
		return children;
	}

	@Override
	public String toString() {
		return getName();
	}

	/**
	 * @return short bio.
	 */
	public String getShortBio() {
		return shortBio;
	}

	/**
	 * @param shortBio
	 */
	public void setShortBio(String shortBio) {
		this.shortBio = shortBio;
	}

	/**
	 * Gets the shopNotes.
	 *
	 * @return Returns the shopNotes
	 */
	public String getShopNotes() {
		return shopNotes;
	}

	/**
	 * Assigns a new value to the shopNotes.
	 *
	 * @param shopNotes the shopNotes to set
	 */
	public void setShopNotes(String shopNotes) {
		this.shopNotes = shopNotes;
	}
	
	public Shop getShop() {
		return shop;
	}
	
	public void setShop(Shop shop) {
		this.shop = shop;
	}
	
}
